<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<style>
:target #match { background-color: green }
#target + div { color: pink }
</style>
<div id="target">
    <div></div>
    <div></div>
    <div>
        <div></div>
        <div id="match"></div>
    </div>
    <div></div>
</div>
<div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</div>
<script>
description("Use descendant invalidation set for :target pseudo class.")

var transparent = "rgba(0, 0, 0, 0)";
var green = "rgb(0, 128, 0)";

shouldBe("getComputedStyle(match, '').backgroundColor", "transparent");

target.offsetTop; // Force recalc.

document.location.hash = "#target";

// Should have checked that internals.updateStyleAndReturnAffectedElementCount()
// equals 2 here, but the target style is updated synchronously from where the
// target is set.

shouldBe("getComputedStyle(match, '').backgroundColor", "green");
</script>
